{extend name="base/list" /}
{block name="body"}

<style type="text/css">
    .box{
        border:1px solid #d5d5d5;
        margin:10px;
    }
    .main_title{
        width:50%;
        margin:10px;
    }
    .main_title .info{
        font-size:16px;
        font-weight: bold;
        padding: 5px 10px;
        border: 1px solid #d5d5d5;
        border-radius: 15px;
    }
    .main_title .edit{
        padding-left: 10px;
        color:#00cbff;
        cursor: pointer;
    }

    .main_content{
        margin:10px;
    }
    .js_preview{
        position:absolute;
        width:60px;
        height:60px;
        margin-left: 10px;
        margin-right:30px;
        border-radius: 30px;
        border:1px solid #d5d5d5;
    }
    .left_content{
        display: inline-block;
        position: relative;
    }
    .right_content{
        margin-left:100px;
    }
    .text{
        margin-right: 15%;
        display: inline-block;
    }
    .text div{
        line-height:30px;
    }
    .brand_name{
    }
    .statistical{
        width:250px;
        height:120px;
        float: left;
        margin: 20px;
        color: #fff;
    }
    .statistical .content{
        height:90px;
        padding:0px 10px;
    }
    .content .icon{
        width:80px;
        height:90px;
        font-size:50px;
        font-weight: bold;
        line-height: 90px;
        text-align: center;
    }
    .content .info{
        width:150px;
        float: right;
        height:90px;
        font-size:16px;
        font-weight: bold;
    }
    .info .number{
        font-size:26px;
    }
    .info p{
        width:100%;
        margin: 10px 0px;
        text-align: right;
    }
    .statistical .title{
        height:30px;
        line-height: 30px;
        padding:0px 10px;
        color:rgba(255, 255, 255, 0.6); 
        background-color:rgba(90, 90, 90, 0.3); 
    }
    .statistical .title:hover{
        color:#fff; 
    }
</style>
{notempty name="data"}
<div class="box">
    <div class="main_title">
        <span class="info">品牌信息</span>
        <span class="edit" onclick="edit()" class="btn btn-xs btn-default edit-btn" {if condition="$permission[2] neq 1"}disabled{/if}><i class="icon wb-edit"></i> 修改品牌信息</span>
    </div>
    <div class="main_content">
        <div class="left_content"> 
            <img class="js_preview" src="" />
        </div>
        <div class="right_content">
            <div class="text">
                <div class="brand_name">品牌名称 : {$data.brand_name}</div>
                <div>创建时间 : {$data.create_time}</div>
            </div> 
            <div class="text">
                <div>有效期限 : 
                    {notempty name="data['begin_use_date']"}
                    {$data.begin_use_date} 至 {$data.end_use_date}
                    {else}
                    {$data.begin_test_date} 至 {$data.end_test_date}
                    {/notempty}
                </div>
                <div>当前状态 :
                    {switch name="$data['use_status']" }
                    {case value="0"}<span style='color:#ff4000'>已过期</span>{/case}
                    {case value="1"}<span style='color:#ff4000'>已停用</span>{/case}
                    {case value="2"}
                    {if condition="$data['status'] eq 2"}
                    <span style='color:#ff4000'>试用中</span>
                    {else/}
                    <span style='color:#085'>使用中</span>
                    {/if}
                    {/case}                    
                    {/switch}
                </div>
            </div>
        </div>
    </div>
</div>
<div class="box">

    <div class="statistical" style="background-color: #1143b3;">
        <div class="content">
            <div class="icon left"><i class="icon wb-graph-up"></i></div>
            <div class="info right"><p class="number">{$statistical['subscribe']}</p><p>今日新增粉丝数</p></div>
        </div>
        <a href="javascript:;" class="js_more_fans"><div class="title">查看更多<i class="icon wb-arrow-right right"></i></div></a>
    </div>
    <div class="statistical" style="background-color: #093;">
        <div class="content">
            <div class="icon left"><i class="icon wb-graph-down"></i></div>
            <div class="info right"><p class="number">{$statistical['un_subscribe']}</p><p>今日流失粉丝数</p></div>
        </div>
        <a href="javascript:;" class="js_more_fans"><div class="title">查看更多<i class="icon wb-arrow-right right"></i></div></a>
    </div>
    <div class="statistical" style="background-color: #909;">
        <div class="content">
            <div class="icon left"><i class="icon wb-user"></i></div>
            <div class="info right"><p class="number">{$statistical['reg']}</p><p>今日新增会员数</p></div>
        </div>
        <a href="javascript:;" class="js_more_mcard"><div class="title">查看更多<i class="icon wb-arrow-right right"></i></div></a>
    </div>
    <div class="statistical" style="background-color: #dedd06;">
        <div class="content">
            <div class="icon left"><i class="icon wb-payment"></i></div>
            <div class="info right"><p class="number">{$statistical['amount']}</p><p>今日充值总额</p></div>
        </div>
        <a href="javascript:;" class="js_more_amount"><div class="title">查看更多<i class="icon wb-arrow-right right"></i></div></a>
    </div>
    <div style="clear:both;">
    </div>
</div>
{/notempty}

{notempty name="store_data"}
<div class="box">
    <div class="main_title">
        <span class="info">门店信息</span>
    </div>
    <div class="main_content">
        <div class="_content">
            <div class="text">
                <div>门店编号：{$store_data.id}</div>
                <div>门店名称：{$store_data.store_name}</div>
                <div>门店地址：{$store_data.province}{$store_data.city}{$store_data.district}{$store_data.address}</div>
            </div>
            <div class="text">
                <div>门店电话：{$store_data.telephone}</div>
                <div>接口ApiKey：{$store_data.api_key}</div>  
            </div>
        </div>
    </div>

</div>
<div class="box">
    <div class="statistical" style="background-color: #dedd06;">
        <div class="content">
            <div class="icon left"><i class="icon wb-payment"></i></div>
            <div class="info right"><p class="number">{$statistical['amount']}</p><p>今日充值总额</p></div>
        </div>
        <a href="javascript:;" class="js_more_amount"><div class="title">查看更多<i class="icon wb-arrow-right right"></i></div></a>
    </div>
    <div style="clear:both;">
    </div>
</div>
{/notempty}

{/block}

{block name="script"}

<script type="text/javascript">
    function edit() {
        var url = getURL('edit');
        openBarWin('编辑品牌信息', 600, 400, url, function () {
            location.reload();
        }, ['保存', '取消']);
    }

    var logo = "{$data.logo_pic}"
    $(function () {
        if (logo != '') {
            $(".js_add_gray").hide();
            $(".js_preview").attr("src", img_base_url + logo).show();
        }
    });
    $(".js_more_fans").click(function () {
        var url = getURL('mcard_fans/index', '', 'membercard');
        location.href = url;
    });
    $(".js_more_mcard").click(function () {
        var url = getURL('mcard_fans/index', '', 'membercard');
        location.href = url;
    });
    $(".js_more_amount").click(function () {
        var url = getURL('mcard_fans/index', '', 'membercard');
        location.href = url;
    });

    function uploadSuccess(btn, file, res) {
        if (res.success) {
            var path = res.data.path;
            if (path != "") {
                $("#logo_pic").val(path);
                $(".js_add_gray").hide();
                $(".js_preview").attr("src", img_base_url + path).show();
                //更新logourl

            }
        } else {
            alert(res.message);
        }
    }

</script>
{/block}